<?php include("../includes/header-member.php") ?>
<title>LazySwim</title>
<link rel="stylesheet" href="store.css" type="text/css" />
</head>

<body>
<div id="page">
    <div id="page-top">
        <div id="page-bottom">
          <div id="header">
                <div id="header-info">
                    <h1>LAZYSWIM</h1>
                    <div class="description">Simplistic Swim System</div>
                </div>
				<!-- Header Goes Here -->
                <?php printHeader(); ?>
				<!-- Header Ends Here -->
                <div id="header-date">Today is <?php echo date('l, F jS, Y'); ?></div>
                <div id="header-cats">
				<!-- Welcome Message Starts Here -->
                    <ul>
					<?php include("../../includes/welcomeBar.php"); ?>
					</ul>
				<!-- Welcome Message Ends Here -->	
                </div>
            </div>
            <div id="main">
                <div id="sidebar">                 
                    <?php
					// include the corresponding navigation pages
                    include("shopSidebar.php");
                    include("../../includes/navigation.php");
					?>     
                </div>                

            <!-- main body -->
            <?php
                // get our category
                $category = ( isset($_GET['catID']) && $_GET['catID'] != "" ) ? $_GET['catID'] : $_POST['catID'];
                echo "<h2>$category</h2><br><br>";
                
                 $products_sql = mysql_query("SELECT DISTINCT(name) from products where category = '$category' order by name") 
                    or die(mysql_error());
                    
                 if( mysql_num_rows($products_sql) == 0 ) {
                    die ("Invalid category");
                    //header('Location:cart.php'); 
                 }
                ?>
                
                <table width="65%" cellpadding="5" cellspacing="5" class="text"> 
                <tr align="center" id="listTableHeader"> 
                    <th>Product Name <th> 
                </tr> 
            <?php                        
            $i = 0;
            while($row = mysql_fetch_row($products_sql)) { 
                // this is just to make the table pretty with alternating tr colours
                if($i % 2) { 
                    $class = 'row1'; 
                } 
                else { 
                    $class = 'row2'; 
                } 
                $i++;
                                
                ?>
                <tr class="<?php echo $class; ?>"> 
                    <td align="center"><?php echo $row[0]; ?></td>
                    <td align="center"><a href="viewProductDetails.php?name=<?php echo $row[0]; ?>">Details ></a></td> 
                </tr> 
                  <?php                    
                } // end of while
                ?>
            <!-- end of main -->
            </table>
            <div class="clear"></div>

            </div>
			<!-- Footer Goes Here -->
            <?php include("../../includes/footer.php"); ?>
			<!-- Footer Ends Here -->
        </div>
    </div>
</div>
</body>
</html>